package flash3.net
{
	import flash.utils.Endian;
	
	import flash3.net.ByteArrayPlus;
	
	public class MsgPacket
	{
		public var _id:uint;
		public var _subid:uint;
		public var _data:ByteArrayPlus;
		
		public static const CHECKCODE			:uint = 16;
		public static const VERSION			:uint = 65;
		public static const SIZE_OF_DATASIZE	:uint = 2;
		public static const SIZE_OF_CHECKCODE	:uint = 1;
		public static const SIZE_OF_VERSION	:uint = 1;
		public static const SIZE_OF_MAINID	:uint = 2;
		public static const SIZE_OF_SUBID		:uint = 2;
		
		public function MsgPacket()
		{
			_data = new ByteArrayPlus();
			_data.endian = Endian.LITTLE_ENDIAN;
		}	
		
		public function get length():Number
		{
			return SIZE_OF_DATASIZE + SIZE_OF_CHECKCODE + SIZE_OF_VERSION + SIZE_OF_MAINID + SIZE_OF_SUBID + _data.length;
		}
	}
}